<div class="blade-content ng-scope" id="blade-content">
  <div class="blade-inner">
    <div class="inner-block">
      <form name="form" class="form" (submit)="onCreate()" [formGroup]="formGroup" novalidate>
        <div class="blade-static __bottom" *ngIf="currentBlade.isNew">
          <button class="btn" [disabled]="!formGroup.valid">创建</button>
        </div>
        <div class="form-group">
          <label class="form-label">所属风场</label>
          <div class="form-input">
            <!--(change)="onFarmChange(farm.value)"-->
            <select name="farmId" #farm class="chosen-select" formControlName="farmId" (change)="onFarmChange(farm.value)">
                <option [value]="item.farmId" *ngFor="let item of farms">
                {{item.farmName}}
              </option>                              
            </select>
          </div>
          <div *ngIf="formErrors.farmId" class="form-error">
            {{ formErrors.farmId }}
          </div>
        </div>

        <div class="form-group">
          <label class="form-label">设备类别</label>
          <div class="form-input">
            <!--(change)="onDeviceCategoryChange(deviceCategory.value)"-->
            <select name="deviceCategoryId" #deviceCategory 
            class="chosen-select" formControlName="deviceCategoryId" (change)="onDeviceCategoryChange(deviceCategory.value)">                  
                  <option [value]="item.deviceCategoryId" 
                  [selected]="item.deviceCategoryId==currentEntity.deviceCategoryId" *ngFor="let item of deviceCagegorys">
                  {{item.deviceCategoryName}}            
                </option>                  
              </select>
          </div>
          <div *ngIf="formErrors.circuitId" class="form-error">
            {{ formErrors.deviceCategoryName }}
          </div>
        </div>
        

        <div class="form-group">
          <label class="form-label">设备名称</label>
          <div class="form-input">
            <input id="deviceName" name="deviceName" type="text" placeholder="输入设备名称" autocomplete="off" formControlName="deviceName">
          </div>
          <div *ngIf="formErrors.deviceName" class="form-error">
            {{ formErrors.deviceName }}
          </div>
        </div>

        <div class="form-group">
          <label class="form-label">设备代码</label>
          <div class="form-input">
            <input id="deviceCode" name="deviceCode" type="text" placeholder="输入设备代码" autocomplete="off" formControlName="deviceCode">
          </div>
          <div *ngIf="formErrors.deviceCode" class="form-error">
            {{ formErrors.deviceCode }}
          </div>
        </div>
        <div class="form-group" *ngIf="isShow">
          <label class="form-label">所属父级</label>
          <div class="form-input">
            <select name="parentId" formControlName="parentId">
                <option [value]="device.deviceId" *ngFor="let device of devicesItems">                                
                     <span> {{device.deviceName}}</span> 
                </option>            
            </select>
          </div>
        </div>

        <div class="form-group">
          <label class="form-label">所属工期</label>
          <div class="form-input">
            <select name="phaseId" class="chosen-select" formControlName="phaseId">
              <option [value]="phase.phaseId" *ngFor="let phase of phases">
                {{phase.phaseName}}
              </option>                              
            </select>
          </div>
          <div *ngIf="formErrors.phaseId" class="form-error">
            {{ formErrors.phaseName }}
          </div>
        </div>



        <div class="form-group">
          <label class="form-label">所属线路</label>
          <div class="form-input">
            <select name="circuitId" class="chosen-select" formControlName="circuitId">                  
                  <option [value]="item.circuitId" [selected]="item.circuitId==currentEntity.circuitId" *ngFor="let item of circuits">
                  {{item.circuitName}}            
                </option>  
                
              </select>
          </div>
          <div *ngIf="formErrors.circuitId" class="form-error">
            {{ formErrors.circuitName }}
          </div>
        </div>



        <div class="form-group" *ngIf="isShow">
          <label class="form-label">分区</label>
          <div class="form-input">
            <select name="subArrayId" formControlName="subArrayId">
                <option [value]="subArray.subArrayId" *ngFor="let subArray of subArrays">                                
                     <span> {{subArray.subArrayName}}</span> 
                </option>            
            </select>
          </div>
        </div>


        <div class="form-group">
          <label class="form-label">型号</label>
          <div class="form-input">
            <select name="modelId" class="chosen-select" formControlName="modelId">
                 <!-- <option value="1" selected="selected">SL1500/82(ABB)</option>  -->
                 <option [value]="item.modelId" *ngFor="let item of models">
                {{item.modelName}}
              </option>  
              </select>
          </div>
          <div *ngIf="formErrors.modelId" class="form-error">
            {{ formErrors.modelName }}
          </div>
        </div>









        <div class="form-group">
          <label class="form-label">经度</label>
          <div class="form-input">
            <input id="longitude" name="longitude" type="text" placeholder="输入风机所在经度" autocomplete="off" formControlName="longitude">
          </div>
          <div *ngIf="formErrors.longitude" class="form-error">
            {{ formErrors.longitude }}
          </div>
        </div>

        <div class="form-group">
          <label class="form-label">纬度</label>
          <div class="form-input">
            <input id="latitude" name="latitude" type="text" placeholder="输入风机所在纬度" autocomplete="off" formControlName="latitude">
          </div>
          <div *ngIf="formErrors.latitude" class="form-error">
            {{ formErrors.latitude }}
          </div>
        </div>

        <div class="form-group">
          <label class="form-label">海拔</label>
          <div class="form-input">
            <input id="elevation" name="elevation" type="text" placeholder="输入风机所处海拔" autocomplete="off" formControlName="elevation">
          </div>
          <div *ngIf="formErrors.elevation" class="form-error">
            {{ formErrors.elevation }}
          </div>
        </div>


        <div class="form-group" *ngIf="!isShow">
          <label class="form-label">标杆风机</label>
          <div class="form-input" id="form-input-switch">
            <label class="form-label __switch">
                  <input type="checkbox" name="turBenchMark" formControlName="turBenchMark" class="ng-pristine ng-untouched ng-valid">
                  <span class="switch"></span>
              </label>
          </div>
        </div>

        <div class="form-group">
          <label class="form-label">排序</label>
          <div class="form-input">
            <input name="seq" formControlName="seq" placeholder="输入排序">
          </div>
          <div *ngIf="formErrors.seq" class="form-error">
            {{ formErrors.seq }}
          </div>
        </div>





      </form>
    </div>
  </div>
</div>